package com.clstu.list;

import java.util.Iterator;
import java.util.LinkedList;

public class LInkedListCRUD {
    public static void main(String[] args) {
        LinkedList linkedList=new LinkedList();
        linkedList.add(1);
        linkedList.add(2);
        linkedList.add(3);
        //linkedList.remove();
        //遍历(实现了List接口，都可以遍历）
        Iterator iterator=linkedList.iterator();
        while (iterator.hasNext()) {
            Object next =  iterator.next();
            System.out.println(next);
        }
        System.out.println("====for===");
        for (int i = 0; i < linkedList.size(); i++) {
            System.out.println(linkedList.get(i));
        }
        System.out.println("====增强for====");
        for(Object o:linkedList){
            System.out.println(o);
        }
        System.out.println(linkedList);
    }
}
